package com.example.demo.exception;

import com.example.demo.entity.Message;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

@RestControllerAdvice
public class ProjectExceptionAdvice {

    @ExceptionHandler(BusyException.class)
    public Message doBusinessException(BusyException be){
        return  Message.failure(401,be.getMessage());
    }


    @ExceptionHandler(Exception.class)
    public Message doException(Exception e){
        return Message.failure(400,"系统其他未知异常");
    }
}
